/*
 * FileProcessor.h
 *
 *  Created on: 2011-2-23
 *      Author:Aeolus
 *  Modified  by Binda,2011-2-23 v1.1
 *
 *   Copyright   : Copyright © 2011 Binda&Aeolus
                   All Rights Reserved
 */

#ifndef FILEPROCESSOR_H_
#define FILEPROCESSOR_H_

#include<iostream>
#include<string>
#include<fstream>
#include<vector>
#include<map>
#include<cstdlib>
using namespace std;

class FileProcessor
{
private:
	ifstream infile;
	ofstream outfile;

public:
	bool open_file(const string filename,ios::openmode mode);
	template <class Type> 	bool output_data(const string filename,const vector<Type>& data);
	template <class Type> 	bool output_data(const string filename,const Type data);
	template <class Type>   void getdata(const string  filename ,vector<Type>  &data, ios::openmode mode=ios::in);
	//Added  by Binda,20011-4-6 v1.2
	template <class Type>   void analyze(const string filename ,map<Type,int> &map_count, ios::openmode mode=ios::in);
	~FileProcessor();
};
#endif /* FILEPROCESSOR_H_ */
